/**
 * 心愿墙
 */
import { request } from '@/utils/request'

/**
 * 分页列表
 */
export function list(params, success) {
	request({
		url: '/api.app/v1/cmsCommonwealActivitys',
		params: params
	}, function(data, total) {
		success && success(data, total)
	})
}

/**
 * 详情
 */
export function detail(id, success) {
	request({
		url: '/api.app/v1/cmsCommonwealActivitys/' + id,
		params: { id: id }
	}, function(data) {
		success && success(data)
	})
}

/**
 * 收藏/取消收藏
 */
export function collect(id, success) {
	request({
		url: '/api.app/v1/cmsCommonwealActivitys/collect',
		params: { activityId: id },
		loading: false
	}, function(data) {
		success && success(data)
	})
}

/**
 * 爱心帮助记录
 */
export function donateList(params, success) {
	request({
		url: '/api.app/v1/cmsCommonwealActivitys/getActivityDonateList',
		params: params
	}, function(data, total) {
		success && success(data, total)
	})
}

/**
 * 捐款
 */
export function pay(params, success) {
	request({
		url: '/api.app/v1/cmsCommonwealActivitys/payActivity',
		method: 'post',
		params: params
	}, function(data) {
		success && success(data)
	})
}
